﻿Public Class Form_newname
    Dim xNamaPlayer() As String = Split(System.IO.File.ReadAllText("jumlahplayer.txt"), vbCrLf)
    Dim xJumlah As Integer = UBound(xNamaPlayer)
    Private Sub PictureBox3_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox3.Click

        Form_enter.Show()
        Me.Close()
    End Sub

    Public Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Dim kelas As New player
        Dim xSimpan() As String = Split(System.IO.File.ReadAllText("jumlahplayer.txt"), vbCrLf)
        Dim xJumlah As Integer = xSimpan.Count
        If xJumlah < 5 Then
            Dim xNama As String
            xNama = TextBox1.Text & ".txt"
            If System.IO.File.Exists(xNama) Then
                MessageBox.Show("That name already exists! / Asmanipun sampun wonten ! ")
            Else
                kelas.Player = TextBox1.Text
                kelas.Temp = TextBox1.Text
                'kelas.Pointer += 1
                kelas.Tambah()
                kelas.urutan = xJumlah
                kelas.nama()
                MsgBox("Welcome / Sugeng Rawuh")
                form_level.Show()
                Me.Close()
            End If
        Else
            MsgBox("Sorry it's full, you can't make another name")
        End If
       
    End Sub

    Private Sub Form_newname_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class